package com.aaa.day1104.demo1;

import java.util.function.Supplier;

/**
 * @Description:
 * @author:LiWei
 * @date:2022年11月04日9:55
 */
public class Test2 {
    public static void main(String[] args) {

        //返回对象的名称
        People people=new People("张三","20");
        Supplier<String> peopleSupplier= () -> people.getName();
//        Supplier<String> supplier= people::getName;
//
//        System.out.println("supplier = " + supplier);
        System.out.println("peopleSupplier = " + peopleSupplier);

    }
}
class People{
    private String name;
    private String age;



    public People(String name, String age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }
    @Override
    public String toString() {
        return "People{" +
                "name='" + name + '\'' +
                ", age='" + age + '\'' +
                '}';
    }

}